package com.mck.service.impl;

import com.mck.anno.OperationLog;
import com.mck.entity.Title;
import com.mck.service.TitleService;
import com.mck.mapper.TitleMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDate;

@Service
public class TitleServiceImpl implements TitleService {

    @Autowired
    private TitleMapper titleMapper;

    // 获取系统标题
    @Override
    public Title getTitle() {
        return titleMapper.getTitle();
    }

    // 更新系统标题
    @OperationLog
    @Override
    public void updateTitle(Title title) {
        // 补充缺少的属性
        title.setUpdateTime(LocalDate.now());

        // 调用mapper接口更新数据
        titleMapper.updateTitle(title);
    }
}
